﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<vector>
using namespace std;
class Person
{
protected:
	string _name = "张三";
	string _address;
	string _tel;
	int _age = 18;
	void func()
	{
		cout << n << endl;
	}
private:
	int n = 10;
};
class student : public Person
{
public:
	void study()
	{
		cout << "学习" << endl;
		func();
	}

protected:
	int _stuid;
};
class teacher : public Person
{
public:
	// 授课
	void teaching()
	{
		//...
	}
protected:
	string title; // 职称
};
namespace bit
	 {
	 //template<class T>
		 //class vector
		 //{};
		
		 // stack和vector的关系，既符合is-a，也符合has-a
		 template < class T>
		 class stack : public std::vector < T>
		 {
		 public:
			void push(const T & x)
				{
				// 基类是类模板时，需要指定⼀下类域，
					// 否则编译报错:error C3861: “push_back”: 找不到标识符
					// 因为stack<int>实例化时，也实例化vector<int>了
					// 但是模版是按需实例化，push_back等成员函数未实例化，所以找不到
					vector<int>::push_back(x);
				//push_back(x);
			}
			void pop()
			{
				vector<T>::pop_back();
			}
			const T& top()
			{
				return vector<T>::back();
			}
			bool empty()
			{
				return vector<T>::empty();
			}
	};
}
template<class Container>
void Print(Container c)
{
	typename Container::const_iterator it = c.begin();
	while (it != c.end())
	{
		cout << "hehe" << " ";
		it++;
	}
}
class A
{
public:
	A(int n)
	{
		cout << "A" << endl;
	}
protected:
	int _a;
};
class B : public A
{
public:
	B()
		:A(1)
	{
		cout << "B" << endl;
	}
private:
	int _b;
};
int main()
{
	B b;
	return 0;
}